package com.difsonapps.android.marker.dialogs;

import org.w3c.dom.Text;

import com.difsonapps.android.marker.IRefresher;
import com.difsonapps.android.marker.R;
import com.difsonapps.android.marker.beans.Album;
import com.difsonapps.android.marker.util.MarkerUtil;

import android.app.Activity;
import android.app.Dialog;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;


public class ViewAlbumDialog extends Dialog{
	Activity activity;
	Album album;
	IRefresher<Album> refresher;
	
	
	TextView nameTextView;
	TextView createdTextView;
	TextView updatedTextView;
	TextView descriptionTextView;
	
	public ViewAlbumDialog(Activity activity, Album album, IRefresher<Album> refresher) {
		super(activity);
		this.activity = activity;
		setTitle(R.string.album_details);
		this.album = album;
		this.refresher = refresher;
		
		setContentView(R.layout.dialog_view_album);
		nameTextView = (TextView)findViewById(R.id.name_text);
		createdTextView = (TextView)findViewById(R.id.created_text);
		updatedTextView = (TextView)findViewById(R.id.updated_text);
		descriptionTextView = (TextView)findViewById(R.id.description_text);
		findViewById(R.id.cancel_button).setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				cancelAction();
			}
		});
		
		if(album!=null){
			nameTextView.setText(album.getName());
			descriptionTextView.setText(album.getDesc());
			createdTextView.setText(MarkerUtil.formatDateFromDefaultFormat(album.getCreated_at()));
			updatedTextView.setText(MarkerUtil.formatDateFromDefaultFormat(album.getModified_at()));
		}
	}
	
	private void cancelAction(){
		dismiss();
	}

}
